import { createRouter, createWebHistory } from 'vue-router'
import Layout from '@/views/Layout'
import Login from '@/views/Login'

const routes = [
  {
    path: '/',
    name: 'Layout',
    component: Layout,
    children: [
      {
        path: '',
        name: 'Home',
        component: () => import(/* webpackChunkName: "Home" */ '@/views/Home')
      },
      {
        path: 'category/:id',
        name: 'Category',
        component: () => import(/* webpackChunkName: "Category" */ '@/views/Category')
      },
      {
        path: 'goods/:id',
        name: 'Goods',
        component: () => import(/* webpackChunkName: "Goods" */ '@/views/Goods')
      },
      {
        path: 'cart',
        name: 'Cart',
        component: () => import(/* webpackChunkName: "Cart" */ '@/views/Cart')
      },
      {
        path: 'settle',
        name: 'Settle',
        component: () => import(/* webpackChunkName: "Settle" */ '@/views/Settle')
      }
    ]
  },
  {
    path: '/login',
    name: 'Login',
    component: Login
  }
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
